package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description
 * User: cjc
 * Date: 2025-03-14
 * Time: 11:03
 */
public class Swap {
    public static  void swap(Value val1,Value val2) {
        int temp = val1.value;
        val1.value = val2.value;
        val2.value = temp;
    }
    public static void main(String[] args) {
        Value val1 = new Value();
        Value val2 = new Value();
        val1.value = 10;
        val2.value = 20;
        System.out.println("交换前：val1.value = "+val1.value+" val2.value = "+val2.value);
        swap(val1,val2);
        System.out.println("交换后：val1.value = "+val1.value+" val2.value = "+val2.value);
    }
}
